﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
//Author: Kha
namespace VietThuongLMS.Services
{
    public class LoaiLopHocService
    {
        public static List<LoaiLopHoc> GetAll()
        {
            var context = new LMSDataEntities();
            try
            {
                var list = context.LoaiLopHocs.ToList();
                return list;
            }
            catch (Exception ex) { throw ex; }
            finally
            {
                context.Dispose();
            }
        }

        public static LoaiLopHoc GetLoaiLopHocById(int id)
        {
            try
            {
                using (LMSDataEntities context = new LMSDataEntities())
                {
                    return context.LoaiLopHocs.Where(c => c.ID == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                DCS.ComLib.File.Log.Write("LoaiLopHocServices::GetLoaiLopHocById", ex.StackTrace, ex.Message);
                return null;
            }
        }

    }
}